package com.xuxueli.applyModules.commont.testTypeToClassMethod;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;

@Component
public class MyInitializingsBean implements InitializingBean {

    static {
        System.out.println("我是statis...");
    }
    public MyInitializingsBean() {
        System.out.println("我是MyInitializingBean构造方法执行...");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("我是afterPropertiesSet方法执行...");
    }

    @PostConstruct
    public void postConstruct() {
        System.out.println("我是postConstruct方法执行...");
    }

    public void init(){
        System.out.println("我是init方法执行...");
    }

    @Bean(initMethod = "init")
    public MyInitializingsBean test() {
        return new MyInitializingsBean();
    }
    //打印加载顺序
    //1.我是statis
    //2.我是MyInitializingBean构造方法执行
    //3.我是postConstruct方法执行
    //4.我是afterPropertiesSet方法执行
    //5.我是init方法执行
}

